#ifndef __V792__
#define __V792__

#include <cstdlib>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>


class V792{
 public:
  V792();
  V792(const char *char_wrd);
  ~V792();

  void Decode(const char *char_wrd);
  std::string GetDecodedData() {return return_decoded_data;};
 
  

 private:

  static const unsigned int V792_SLOT_ID_MASK;
  static const unsigned int V792_WORD_TYPE_MASK;

  static const unsigned int V792_CRATE_NUMBER_MASK;
  static const unsigned int V792_HIT_CHANNELS_MASK;
  static const unsigned int V792_EVENT_COUNTER_MASK;
  static const unsigned int V792_CHANNEL_NUMBER_MASK;

  static const unsigned int V792_DATA_VALID_MASK;
  static const unsigned int V792_UNDER_THRESHOLD_MASK;
  static const unsigned int V792_OVERFLOW_MASK;
  static const unsigned int V792_DATA_MASK;

  static const unsigned int V792_WORD_TYPE_NOT_VALID_DATUM;
  static const unsigned int V792_WORD_TYPE_HEADER;
  static const unsigned int V792_WORD_TYPE_END_OF_BLOCK;
  static const unsigned int V792_WORD_TYPE_VALID_DATUM;

 
  unsigned int  slot_id;
  unsigned int  word_type;
  unsigned int  crate_number;
  unsigned int  hit_channels;
  unsigned int  event_counter;
  unsigned int  channel_number;

  unsigned int  data_valid;
  unsigned int  overflow;
  unsigned int  underthreshold;
  unsigned int  data;
  unsigned int  word_type_not_valid_datum;
  unsigned int  word_type_header;
  unsigned int  word_type_end_of_block;
  unsigned int  word_type_valid_datum;
  unsigned int  word_type_reserved;
 

  std::string         return_decoded_data;
  std::ostringstream  decoded_stream;

 
  bool data_input_flag;

  unsigned int BitMaskShift(long int wrd, unsigned int mask, unsigned short shift)
  {
    return ( (wrd&mask)>>shift );
  }

  // V792 class Debug Purpose
  void   PrintHeader();
  void   PrintData();
  
};



#endif
